
var ec_center = echarts.init(document.getElementById("c2"),"dark");

var uploadedDataURL = '/beijing';

function showProvince() {
    var name = 'bj';

    // myChart.showLoading();

    $.get(uploadedDataURL, function (geoJson) {
        // myChart.hideLoading();

        echarts.registerMap(name, geoJson);

        ec_center.setOption(
            (option = {
                backgroundColor: '#010b33',
                title: {
                    text: '北京市各区用电量图（纯属虚构）',
                    subtext: '时间周期：2021.01.01——2021.06.30',
                    left: 'center',
                    textStyle: {
                        color: '#ffffff',
                    },
                },
                visualMap: {
                    min: 0,
                    max: 45000,
                    left: 'left',
                    top: 'bottom',
                    text: ['高', '低'], // 文本，默认为数值文本
                    calculable: true,
                    inRange: {
                        color: ['yellow', 'lightskyblue', 'orangered'],
                    },
                },
                series: [
                    {
                        type: 'map',
                        mapType: name,
                        zoom: 1, //当前视角的缩放比例
                        roam: true, //是否开启平游或缩放
                        scaleLimit: { //滚轮缩放的极限控制
                        min: 1,
                        max: 2
                        },
                        label: {
                            normal: {
                                show: true,
                            },
                            emphasis: {
                                textStyle: {
                                    color: '#ffffff',
                                },
                            },
                        },
                        itemStyle: {
                            normal: {
                                borderColor: '#389BB7',
                                areaColor: '#ffffff',
                            },
                            emphasis: {
                                areaColor: '#389BB7',
                                borderWidth: 0,
                            },
                        },
                        animation: false,
                        data: [
                            {
                                name: '东城区',
                                value: 38163,
                                label: {
                                    normal: {
                                        show: false,
                                    },
                                },
                            },
                            {
                                name: '西城区',
                                value: 32036,
                                label: {
                                    normal: {
                                        show: false,
                                    },
                                },
                            },
                            {
                                name: '海淀区',
                                value: 39825,
                            },
                            {
                                name: '朝阳区',
                                value: 48405,
                            },
                            {
                                name: '石景山区',
                                value: 15212,
                                label: {
                                    normal: {
                                        show: false,
                                    },
                                },
                            },
                            {
                                name: '大兴区',
                                value: 26681,
                            },
                            {
                                name: '门头沟区',
                                value: 11161,
                            },
                            {
                                name: '昌平区',
                                value: 40687,
                            },
                            {
                                name: '通州区',
                                value: 31488,
                            },
                            {
                                name: '房山区',
                                value: 23053,
                            },
                            {
                                name: '丰台区',
                                value: 26504,
                            },
                            {
                                name: '顺义区',
                                value: 17247,
                            },
                            {
                                name: '怀柔区',
                                value: 21812,
                            },
                            {
                                name: '密云区',
                                value: 18589,
                            },
                            {
                                name: '延庆区',
                                value: 22211,
                            },
                            {
                                name: '平谷区',
                                value: 16729,
                            },
                        ],
                        // animationDurationUpdate: 1000,
                        // animationEasingUpdate: 'quinticInOut'
                    },
                ],
            })
        );
    });
}

var currentIdx = 0;

showProvince();
